package com.netflexitysolutions.amazonws.ec2.internal.operations;

import com.amazonaws.ec2.doc._2009_04_04.AssociateAddressType;
import com.netflexitysolutions.amazonws.ec2.EC2;

public class AssociateAddressOperation extends OperationExecutor<AssociateAddressType, Boolean> {
	
	private String instanceId;
	
	private String ip;
	
	public AssociateAddressOperation(EC2 ec2, String instanceId, String ip) {
		super(ec2);
		this.instanceId = instanceId;
		this.ip = ip;
	}

	@Override
	protected Boolean call(AssociateAddressType request) {
		request.setInstanceId(instanceId);
		request.setPublicIp(ip);
		return getEC2().getService().associateAddress(request).isReturn();
	}

}
